import React from 'react'
import { BrowserRouter, Route, Routes } from 'react-router-dom'
import { routes, IRoute } from './routes'
const routerView = (routes: IRoute[]) => {
	return routes.map((v, i) => {
		return <Route path={ v.path } element={ <v.element></v.element> } key={i}>
			{ v.children && routerView(v.children) }
		</Route>
	})
}


const Router: React.FC = () => {
	return (
		<BrowserRouter>
			<Routes>
				{
					routerView(routes)
				}
			</Routes>
		</BrowserRouter>
	)
}
export default Router